﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.CApC3DAppearance
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using EngineeringInternalExtension;
using System.Collections.Generic;
using Tecnomatix.Engineering;


namespace DnProcessSimulateCommands;

internal class CApC3DAppearance
{
  private TxGraphicsAnimationAppearance m_appearance;
  private List<TxSnapshot> m_snapshots = new List<TxSnapshot>();

  public CApC3DAppearance(ITxObject obj, string viewId, TxSnapshot snapshot)
  {
    TxPmi txPmi = obj as TxPmi;
    TxNote txNote = obj as TxNote;
    if (txPmi != null)
    {
      this.m_appearance = new TxGraphicsAnimationAppearance((ITxObject) txPmi, viewId);
      this.m_appearance.BackgroundColor = TxColor.TxColorWhite;
      this.m_appearance.ForegroundColor = txPmi.TextColor;
      this.m_appearance.RelativeTextPosition = txPmi.FlagRelativePosition;
      TxPmiTextDisplayMode textDisplayMode = txPmi.TextDisplayMode;
      if (textDisplayMode != null)
      {
        if (textDisplayMode == 1)
          this.m_appearance.FlatToScreenFontSize = txPmi.FontSize;
      }
      else
        this.m_appearance.InPlaneCharacterSize = (double) txPmi.CharacterSize;
    }
    else if (TxNote.op_Inequality(txNote, (ITxObject) null))
    {
      this.m_appearance = new TxGraphicsAnimationAppearance((ITxObject) txNote, viewId);
      this.m_appearance.BackgroundColor = txNote.Color;
      this.m_appearance.ForegroundColor = txNote.TextColor;
      this.m_appearance.RelativeTextPosition = txNote.FlagRelativePosition;
      this.m_appearance.FlatToScreenFontSize = txNote.Font.SizeInPoints;
    }
    if (this.m_snapshots.Contains(snapshot))
      return;
    this.m_snapshots.Add(snapshot);
  }

  public bool IsEquivalent(ITxObject obj)
  {
    bool flag = false;
    TxPmi txPmi = obj as TxPmi;
    TxNote txNote = obj as TxNote;
    if (txPmi != null)
    {
      if (TxColor.op_Equality(this.m_appearance.ForegroundColor, txPmi.TextColor) && TxVector.op_Equality(this.m_appearance.RelativeTextPosition, txPmi.FlagRelativePosition) && (this.m_appearance.FlatToScreenFontSize == txPmi.FontSize && txPmi.TextDisplayMode == 1 || this.m_appearance.InPlaneCharacterSize == (double) txPmi.CharacterSize && txPmi.TextDisplayMode == null))
        flag = true;
    }
    else if (TxNote.op_Inequality(txNote, (ITxObject) null) && TxColor.op_Equality(this.m_appearance.BackgroundColor, txNote.Color) && TxColor.op_Equality(this.m_appearance.ForegroundColor, txNote.TextColor) && TxVector.op_Equality(this.m_appearance.RelativeTextPosition, txNote.FlagRelativePosition) && this.m_appearance.FlatToScreenFontSize == txNote.Font.SizeInPoints)
      flag = true;
    return flag;
  }

  public void AddSnapshot(TxSnapshot snapshot)
  {
    if (this.m_snapshots.Contains(snapshot))
      return;
    this.m_snapshots.Add(snapshot);
  }

  public bool DoesExistInSnapshot(TxSnapshot snapshot)
  {
    foreach (TxSnapshot snapshot1 in this.m_snapshots)
    {
      if (TxSnapshot.op_Equality(snapshot1, (ITxObject) snapshot))
        return true;
    }
    return false;
  }

  public TxGraphicsAnimationAppearance GetData() => this.m_appearance;
}
